<?php
// +----------------------------------------------------------------------
// | CatchAdmin [Just Like ～ ]
// +----------------------------------------------------------------------
// | Copyright (c) 2017~2020 http://catchadmin.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( https://github.com/yanwenwu/catch-admin/blob/master/LICENSE.txt )
// +----------------------------------------------------------------------
// | Author: JaguarJack [ njphper@gmail.com ]
// +----------------------------------------------------------------------

namespace catchAdmin\sms\model;

use catchAdmin\sms\model\search\SmsTemplateSearch;
use catchAdmin\smstopic\model\SmsTopic;
use catcher\base\CatchModel;
use catcher\base\CatchModel as Model;

class SmsTemplate extends CatchModel
{
    use SmsTemplateSearch;

    protected $name = 'sms_template';

    protected $field = [
        'id', //
        'title', // 模版名称
        'sms_topic', // 模版主题
        'content', // 模版内容
        'creator_id', // 创建人ID
        'created_at', // 创建时间
        'updated_at', // 更新时间
        'deleted_at', // 软删除
        'sms_topic_id', // 软删除
    ];

    public function getTemplateById(int $templateId)
    {
        return $this->alias("t1")->catchLeftJoin(SmsTopic::class, "id", "sms_topic_id", ["model"])->field("t1.*")->where("t1.id", "=", $templateId)->find();


    }


}